public class Sleep{

    public static void main(String[] args){

        My m = new My();
        Thread t = new Thread(m, "thread007");

        t.start();

    }

}


class My implements Runnable{

    public void run(){
        for(int i = 0; i < 3; i++){
            try{
                // use sleep()
                Thread.sleep(2000);
            }catch(Exception e){
                e.printStackTrace();
            }

            System.out.println(Thread.currentThread().getName() + " ---> " + i);
        }
    }

}